//
// Created by Tony on 2024/1/14.
//

#ifndef COMPILER_VISITOR_H
#define COMPILER_VISITOR_H

#include "../common/ErrorRecorder.h"
#include "../parser/ast/leaf/BooleanLiteral.h"
#include "../parser/ast/leaf/CharLiteral.h"
#include "../parser/ast/leaf/Flt64Literal.h"
#include "../parser/ast/leaf/Int64Literal.h"
#include "../parser/ast/leaf/Name.h"
#include "../parser/ast/leaf/NullLiteral.h"
#include "../parser/ast/leaf/Operator.h"
#include "../parser/ast/leaf/StringLiteral.h"
#include "../parser/ast/list/AccessFlags.h"
#include "../parser/ast/list/TypeTag.h"
#include "../parser/ast/list/array/ArrayIndex.h"
#include "../parser/ast/list/clazz/ClassBody.h"
#include "../parser/ast/list/clazz/ClassDefine.h"
#include "../parser/ast/list/clazz/ClassModule.h"
#include "../parser/ast/list/clazz/FieldDefine.h"
#include "../parser/ast/list/clazz/MethodDefine.h"
#include "../parser/ast/list/clazz/NativeMethodDecl.h"
#include "../parser/ast/list/expr/BinaryExpr.h"
#include "../parser/ast/list/expr/TernaryExpr.h"
#include "../parser/ast/list/expr/UnaryExpr.h"
#include "../parser/ast/list/function/ArgumentList.h"
#include "../parser/ast/list/function/FunctionDefine.h"
#include "../parser/ast/list/function/ParameterList.h"
#include "../parser/ast/list/module/Module.h"
#include "../parser/ast/list/stmt/AssertStmt.h"
#include "../parser/ast/list/stmt/BlockStmt.h"
#include "../parser/ast/list/stmt/ForStmt.h"
#include "../parser/ast/list/stmt/IfStmt.h"
#include "../parser/ast/list/stmt/NullStmt.h"
#include "../parser/ast/list/stmt/ReturnStmt.h"
#include "../parser/ast/list/stmt/SimpleStmt.h"
#include "../parser/ast/list/stmt/VarDefStmt.h"
#include "../parser/ast/list/view_build/ViewBuilderBlock.h"
#include "../parser/ast/list/view_build/ViewBuilderList.h"
#include <cstdint>

namespace Compiler {

class Visitor : public ErrorRecorder {
public:
    ~Visitor() override = default;

    virtual int32_t visit(Parser::Ast* ast) = 0;

    // Literal
    virtual int32_t visit(Parser::BooleanLiteral* ast) = 0;
    virtual int32_t visit(Parser::CharLiteral* ast) = 0;
    virtual int32_t visit(Parser::Flt64Literal* ast) = 0;
    virtual int32_t visit(Parser::Int64Literal* ast) = 0;
    virtual int32_t visit(Parser::NullLiteral* ast) = 0;
    virtual int32_t visit(Parser::StringLiteral* ast) = 0;

    // Name
    virtual int32_t visit(Parser::Name* ast) = 0;

    // Op
    virtual int32_t visit(Parser::Operator* ast) = 0;

    // Expr
    virtual int32_t visit(Parser::BinaryExpr* ast) = 0;
    virtual int32_t visit(Parser::TernaryExpr* ast) = 0;
    virtual int32_t visit(Parser::UnaryExpr* ast) = 0;

    // Type Tag
    virtual int32_t visit(Parser::TypeTag* ast) = 0;
    virtual int32_t visit(Parser::AccessFlags* ast) = 0;

    // Statement
    virtual int32_t visit(Parser::SimpleStmt* ast) = 0;
    virtual int32_t visit(Parser::AssertStmt* ast) = 0;
    virtual int32_t visit(Parser::BlockStmt* ast) = 0;
    virtual int32_t visit(Parser::ForStmt* ast) = 0;
    virtual int32_t visit(Parser::IfStmt* ast) = 0;
    virtual int32_t visit(Parser::NullStmt* ast) = 0;
    virtual int32_t visit(Parser::VarDefStmt* ast) = 0;
    virtual int32_t visit(Parser::ReturnStmt* ast) = 0;

    // array
    virtual int32_t visit(Parser::ArrayIndex* ast) = 0;

    // function
    virtual int32_t visit(Parser::ParameterList* ast) = 0;
    virtual int32_t visit(Parser::FunctionDefine* ast) = 0;
    virtual int32_t visit(Parser::ArgumentList* ast) = 0;

    // module
    virtual int32_t visit(Parser::Module* ast) = 0;

    // class
    virtual int32_t visit(Parser::FieldDefine* ast) = 0;
    virtual int32_t visit(Parser::MethodDefine* ast) = 0;
    virtual int32_t visit(Parser::NativeMethodDecl* ast) = 0;
    virtual int32_t visit(Parser::ClassBody* ast) = 0;
    virtual int32_t visit(Parser::ClassDefine* ast) = 0;
    virtual int32_t visit(Parser::ClassModule* ast) = 0;

    // view
    virtual int32_t visit(Parser::ViewBuilder* ast) = 0;
    virtual int32_t visit(Parser::ViewBuilderList* ast) = 0;
    virtual int32_t visit(Parser::ViewBuilderBlock* ast) = 0;
    virtual int32_t visit(Parser::AttributeSetter* ast) = 0;
    virtual int32_t visit(Parser::AttributeSetterList* ast) = 0;
};

} // namespace Compiler

#endif // COMPILER_VISITOR_H
